package com;

import com.cencat.domain.Student;
import com.cencat.service.StudentService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.io.IOException;
import java.util.List;

public class app {
    public static void main(String[] args) throws IOException {

        // 测试mybatis
        /*InputStream inputStream= Resources.getResourceAsStream("config.xml");
        SqlSessionFactory sqlSessionFactory=new SqlSessionFactoryBuilder().build(inputStream);
        SqlSession sqlSession=sqlSessionFactory.openSession();
        StudentMapper mapper = sqlSession.getMapper(StudentMapper.class);
        Student byId = mapper.findById(1);
        System.out.println(byId);*/

        // spring
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        StudentService studentService = (StudentService) context.getBean("studentService");
        Student studentById = studentService.getStudentById(1);
        System.out.println(studentById.toString());

    }





}
